<?php
/**
 * Detach components from a project
 *
 */

class Detach extends Controller {

	function Detach() {
		parent::Controller();
	}

	/**
	 * Detach an account from a project
	 *
	 * @param	integer	$id	the project id
	 * @param	integer	by POST the account id
	 */
	function account($id) {
		assert(is_numeric($id));

		$this->project_id = $id;
		if( isset($_POST['submit']) ) {
			$account_id = $this->input->post('account_id');
			assert($account_id);

			$this->Projects->detach_account($id, $account_id);
		}

		redirect( 'project/view/id/'.$id.'#attached-accounts', 'location');
	}
}

?>
